﻿namespace ShellNavigator.Client.Behaviour
{
  #region

  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Input;

  #endregion

  /// <summary>
  ///    Execute command on MouseDoubleClickEvent.
  /// </summary>
  public class ListBoxBehaviour
  {
    #region Constants and Fields

    public static readonly DependencyProperty MouseDoubleClickCommandProperty =
      EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
        Control.MouseDoubleClickEvent, "MouseDoubleClickCommand", typeof(ListBoxBehaviour));

    public static readonly DependencyProperty KeyUpCommandProperty =
      EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
        Control.KeyUpEvent, "KeyUpCommand", typeof(ListBoxBehaviour));

    #endregion

    #region Public Methods

    public static ICommand GetMouseDoubleCommand(DependencyObject o)
    {
      return o.GetValue(MouseDoubleClickCommandProperty) as ICommand;
    }

    public static void SetMouseDoubleClickCommand(DependencyObject o, ICommand value)
    {
      o.SetValue(MouseDoubleClickCommandProperty, value);
    }

    public static ICommand GetKeyUpCommand(DependencyObject o)
    {
      return o.GetValue(KeyUpCommandProperty) as ICommand;
    }

    public static void SetKeyUpCommand(DependencyObject o, ICommand value)
    {
      o.SetValue(KeyUpCommandProperty, value);
    }


    #endregion
  }
}
